Feat/platform 696: accept custom cloudfront distribution#33
Feat/platform 696: accept custom cloudfront distribution#33oscar-dbbs wants to merge 11 commits intomainfrom
Conversation
oscar-dbbs
commented
Aug 16, 2024
- if custom cloudfront was passed, avoid creating new cloudfront and use existing instead
- attach origin, update existing behavior and add additional behaviors for existing cloudfront together with lambda edge
| additionalBehaviors: { | ||
| ['/_next/data/*']: { | ||
| if (customCloudFrontId && customCloudFrontDomainName) { | ||
| this.cf = cloudfront.Distribution.fromDistributionAttributes(this, id, { |
There was a problem hiding this comment.
we also need to add new rules and lambda to existing cloudfront
There was a problem hiding this comment.
we can call this.cf.addBehaviour
There was a problem hiding this comment.
Unfortunately, this isn't supported by the cloudformation stack. we can only add existing id to the cloud formation template (which is what I did here by setting it to the output).
aws/aws-cdk#12524
|
|
||
| // if custom cf distribution, update it | ||
| if (customCFDistribution) { | ||
| await updateDistribution(cloudfrontClient, customCFDistribution, { |
There was a problem hiding this comment.
we should do that inside stack, otherwise we will keep changing cloudfront with each deployment
There was a problem hiding this comment.
same as the above comment. I searched and there is no way to update the distribution inside the stack.
aws/aws-cdk#12524
There was a problem hiding this comment.
can we check at least that those origins and rules were already added, so we can skip that step?
There was a problem hiding this comment.
I will create a function to check this then.
32bc4ac to
90d3316
Compare